<script src="{{ asset('lib/xm-select-v1.2.4/xm-select.js')}}"></script>
<script>
    var Tier = 0;
    var tdTpl = '';
    var DetailTitle = {};
    var tableRow = 1;
    var roleUser;
    var AddFlag = true;
    var EditFlag = true;
    var AddRowFlag = true;
    layui.use(['layer','form','table','laytpl','laydate','element'], function(){
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var laytpl = layui.laytpl;
        var laydate = layui.laydate;
        var element = layui.element;
        var scale_type = "{{request()->get('type',0)}}"; 
        var xmDemo; //多选下拉框实例
        var xmDemo2; //多选下拉框实例
        var xmDemo3; //多选下拉框实例

        pageInit();
        renderSelect();
        // 新增提交
        form.on('submit(subDetail)', function(datas) {
            let data = datas.field;
            data.check_module = xmDemo.getValue('value');
            data.check_module_text = xmDemo.getValue('nameStr');
            if(parseInt(data.single_score)>0 && parseInt(data.single_score) < parseInt(data.default_score)){
                layer.msg('单项分数不能小于默认单项分数');return false;
            }
            addScaleDetail(data, function(res) {
                if(res.code == '1'){
                    layer.msg('提交成功', {icon: 6, time: 1000}, function(){
                        pageInit();
                        layer.closeAll()
                    });
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
            
            return false;
        });
        // 编辑提交
        form.on('submit(editDetail)', function(datas) {
            let data = datas.field;
            data.check_module = xmDemo3.getValue('value');
            data.check_module_text = xmDemo3.getValue('nameStr');
            if(parseInt(data.single_score)>0 && parseInt(data.single_score) < parseInt(data.default_score)){
                layer.msg('单项分数不能小于默认单项分数');return false;
            }
            editScaleDetail(data, function(res) {
                if(res.code == '1'){
                    layer.msg('提交成功', {icon: 6, time: 1000}, function(){
                        pageInit();
                        layer.closeAll()
                    });
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
            
            return false;
        });
        // 新增行内容提交
        form.on('submit(subRowDetail)', function(datas) {
            let data = datas.field;
            data.check_module = xmDemo2.getValue('value');
            data.check_module_text = xmDemo2.getValue('nameStr');
            if(parseInt(data.single_score)>0 && parseInt(data.single_score) < parseInt(data.default_score)){
                layer.msg('单项分数不能小于默认单项分数');return false;
            }
            addRowScaleDetail(data, function(res) {
                if(res.code == '1'){
                    layer.msg('提交成功', {icon: 6, time: 1000}, function(){
                        pageInit();
                        layer.closeAll()
                    });
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
            
            return false;
        });

        function pageInit() {
            getScaleById({id: ScaleId}, function(res) {
                if(res.code === 1) { 
                    let Scale = res.data.scale;
                    let TableData = res.data.table_data;

                    Tier = Scale.tier_num;
                    
                    for (i = 1; i <= Tier; i++) { 
                        let chinaNum = convertToChinaNum(i);
                        
                        DetailTitle[i] = chinaNum;
                    }
                    
                    form.val('addDetailForm', {
                        'tier': Scale ? Scale.tier_num : 0,
                        'scale_id': Scale ? Scale.id : 0,
                    });
                    form.val('addRowDetailForm', {
                        'tier': Scale ? Scale.tier_num : 0,
                        'scale_id': Scale ? Scale.id : 0,
                    });
                    form.render();
                    
                    renderTable(TableData);
                }
            });
        }
       
        // 渲染表格数据
        function renderTable(d = {}) {
            if(Tier <= 0) return;

            // 获取角色人员
            getRoleUsers({role_id: 3}, function(res) {
                if(res.code === 1) {
                    roleUser = res.data;

                   // renderReviewerList();
                    
                    var cols = [];
                    var titleArr = [];
                    cols.push({type: 'numbers', title: '序号', align: 'center'});
                    for (let i in DetailTitle) { 
                        let filed = 'title'+i;
                        let filedTitle = DetailTitle[i]+'级指标';
                        
                        titleArr.push(filed);
                        cols.push({field: filed, title: filedTitle, align: 'center'});
                    }
                    
                    cols.push({field: '', title: '单项分数', align: 'center', edit: 'text',templet: function (d){
                        return d.single_score;                      
                    }});
                    cols.push({field: 'check_module_text', title: '对应模块', align: 'center', edit: 'text'});
                    // cols.push({field: 'self_rate', title: '教师自评', align: 'center', templet: '#switchTpl', unresize: true});
                    // cols.push({field: 'reviewer', title: '评审人', align: 'center', templet: function (d) {
                    //     let selectTpl = '<select name="reviewer" class="layui-select" lay-filter="reviewerTableList" data-state="' + d.reviewer + '" data-value="' + d.id + '" >';
                    //     for(var i in roleUser){
                    //         selectTpl += '<option value="'+roleUser[i].user_id+'">' + roleUser[i].user_name + '</option>';
                    //     }
                    //     selectTpl += '</select>';
                    //     return selectTpl;
                    // }});
                    cols.push({title: '操作', width: '16%', align: 'center', toolbar: '#opDemo', fixed:'right'});
                    
                    table.render({
                        elem: '#scale-detail-table'
                        ,toolbar: '#detailToolbarHead' //开启头部工具栏，并为其绑定左侧模板
                        ,defaultToolbar: []
                        ,data: d               
                        ,cols: [cols]
                        ,id: 'scaleDetailTable'
                        ,limit: d.length
                        ,done: function(res, curr, count) {
                            layuiRowspan(titleArr, 1);

                            var tableElem = this.elem.next('.layui-table-view');
                            count || tableElem.find('.layui-table-header').css('overflow', 'auto');
                            layui.each(tableElem.find('select[name="reviewer"]'), function (index, item) {
                                var elem = $(item);
                                elem.val(elem.data('state')).parents('div.layui-table-cell').css('overflow', 'visible');
                            });
                            form.render();     
                        }
                    });
                }
            });
        }

        // 渲染评审人下拉选择控件
        function renderReviewerList() {
            $('[data-role=reviewerList]').empty().append('<option value="">请选择</option>');
            for(var i in roleUser){
                $('[data-role=reviewerList]').append('<option value="'+roleUser[i].user_id+'">' + roleUser[i].user_name + '</option>');
            }             
            form.render('select');
        }

        //监听是否自评操作
        form.on('switch(selfRate)', function(obj){
            let isSelf = obj.elem.checked == true ? 1 : 2;

            updateScaleDetail({id: this.value, self_rate: isSelf}, function(res) {
                if(res.code === 1){
                    layer.msg('修改成功', {icon: 6, time: 1000});
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
        });
        //监听单元格选择
        form.on('select(reviewerTableList)', function (data) {//修改类型
            let id = data.elem.dataset.value; //当前数据的id
            let reviewer = data.elem.value; //当前字段变化的值
            
            updateScaleDetail({id: id, reviewer: reviewer}, function(res) {
                if(res.code === 1){
                    layer.msg('修改成功', {icon: 6, time: 1000});
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
        });  
        //监听单元格编辑
        table.on('edit(scaleDetailTable)', function(obj){
            var value = obj.value //得到修改后的值
                ,data = obj.data //得到所在行所有键值
                ,field = obj.field; //得到字段
            
            var param = {id: data.id};
            param[field] = obj.value;
            updateScaleDetail(param, function(res) {
                if(res.code == '1'){
                    layer.msg('修改成功', {icon: 6, time: 1000});
                }else{
                    layer.msg(res.msg, {icon: 5,shift : 6});
                }
            });
        });

        //表格头工具栏事件
        table.on('toolbar(scaleDetailTable)', function(obj){
            switch(obj.event){
                case 'add':
                    //处理表单
                    dealForm(1, AddFlag);
                    var formVal = {
                        'default_score': 0,
                        'single_score': 0,
                    };
                    
                    for (let i in DetailTitle) {

                        let filed = 'title'+i;
                        let filedVal = '';

                        let obj = {};
                        obj['title['+i+']'] = filedVal;
                        Object.assign(formVal, obj);
                    }
                    form.val('addDetailForm', formVal);
                    xmDemo.setValue([]);
                    form.render();
                    var index = layer.load(2);
                    layer.open({
                        type: 1, 
                        title:'新增量表考核内容',
                        content: $('#add-detail'),
                        area: ['800px', '600px'],
                        end: function() {
                            $('#add-detail').hide();
                        }
                    });
                    layer.close(index);
                break;
            };
        });


        // 监听行工具事件
        table.on('tool(scaleDetailTable)', function(obj){
            var data = obj.data;
            
            if(obj.event === 'del'){
                layer.confirm('确定删除吗?', function(index){
                    delScaleDetail({id: data.id}, function(res) {
                        if (res.code == '9') {
                            layer.msg(res.msg, {icon: 5, shift: 6});
                        } else {
                            layer.msg('删除成功', {icon: 6,time: 1000},function(){
                                obj.del();
                                layer.close(index);
                            });
                        }
                    });
                });
            } else if(obj.event === 'edit'){
               // console.log(data);
                //处理表单
                dealForm(2, EditFlag);
                var index = layer.load(2);
                var formVal = {
                    'id': data.id,
                    'single_score': data.single_score,
                    'default_score': data.default_score,
                    'scale_index': data.scale_index,
                };
                xmDemo3.setValue(data.check_module != ''?JSON.parse(data.check_module):[]);
                for (let i in DetailTitle) { 
                    let filed = 'title'+i;
                    let filedVal = data[filed];

                    let obj = {};
                    obj['title['+i+']'] = filedVal;
                    Object.assign(formVal, obj);
                }
                form.val('editDetailForm', formVal);
                form.render();

                layer.open({
                    type: 1, 
                    title:'编辑量表考核内容',
                    content: $('#edit-detail'),
                    area: ['800px', '600px'],
                    end: function() {
                        $('#edit-detail').hide();
                    }
                });
                layer.close(index);
            } else if(obj.event === 'add'){
                //处理表单
                dealForm(3, AddRowFlag);
                let dtLength = Object.keys(DetailTitle).length;

                if(dtLength === 1) {
                    var index = layer.load(2);
                    layer.open({
                        type: 1, 
                        title:'新增量表考核内容',
                        content: $('#add-detail'),
                        area: ['800px', '600px'],
                        end: function() {
                            $('#add-detail').hide();
                        }
                    });
                    layer.close(index);
                } else {
                    var index = layer.load(2);
                    var formVal = {
                        'id': data.id,
                        'top_id': data.top_id,
                        'default_score': 0,
                        'single_score': 0,
                    };
                    
                    for (let i in DetailTitle) {
                        if(i == 1) {
                            $('#add-row-detail').find("#detail-title-"+i).attr("disabled","disabled").addClass('layui-disabled');
                        }
                        let filed = 'title'+i;
                        let filedVal = data[filed];

                        let obj = {};
                        obj['title['+i+']'] = filedVal;
                        Object.assign(formVal, obj);
                    }
                    form.val('addRowDetailForm', formVal);
                    xmDemo2.setValue([]);
                    form.render();

                    layer.open({
                        type: 1, 
                        title:'新增量表考核内容',
                        content: $('#add-row-detail'),
                        area: ['800px', '600px'],
                        end: function() {
                            $('#add-row-detail').hide();
                        }
                    });
                    layer.close(index); 
                }
            }
        });
        $(".cancel-btn").on('click', function() {
            layer.close(layer.index)
        });

        //表单处理
        function dealForm(type = 0, flag = true) {
            let html = '';
            if(!flag) return;

            for (let i in DetailTitle) { 
                let item = ''; 
                item += '<div class="layui-form-item">';
                item += '<label class="layui-form-label layuik-form-label"><i class="redstar">*</i>'+DetailTitle[i]+'级指标：</label>';
                item += '<div class="layui-input-block layuik-input-block">';
                item += '<input type="text" name="title['+i+']" id="detail-title-'+i+'" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">';
                item += '</div>';
                item += '</div>';
                
                html += item;
            }

            switch(type) {
                case 1:
                    $("#add-detail-form").prepend(html);
                    AddFlag = false;
                    break;
                case 2:
                    $("#edit-detail-form").prepend(html);
                    EditFlag = false;
                    break;
                case 3:
                    $("#add-row-detail-form").prepend(html);
                    AddRowFlag = false;
                    break;
            }
        }

        var execRowspan = function (fieldName, index, flag) {
            // 1为不冻结的情况，左侧列为冻结的情况
            let fixedNode = index == "1" ? $(".layui-table-body")[index - 1] : (index == "3" ? $(".layui-table-fixed-r") : $(".layui-table-fixed-l"));
            // 左侧导航栏不冻结的情况
            let child = $(fixedNode).find("td");
            let childFilterArr = [];
            // 获取data-field属性为fieldName的td
            for (let i = 0; i < child.length; i++) {
                if (child[i].getAttribute("data-field") == fieldName) {
                    childFilterArr.push(child[i]);
                }
            }
            // 获取td的个数和种类
            let childFilterTextObj = {};
            for (let i = 0; i < childFilterArr.length; i++) {
                let childText = flag ? childFilterArr[i].innerHTML : childFilterArr[i].textContent;
                if (childFilterTextObj[childText] == undefined) {
                    childFilterTextObj[childText] = 1;
                } else {
                    let num = childFilterTextObj[childText];
                    childFilterTextObj[childText] = num * 1 + 1;
                }
            }
            let canRowspan = true;
            let maxNum;//以前列单元格为基础获取的最大合并数
            let finalNextIndex;//获取其下第一个不合并单元格的index
            let finalNextKey;//获取其下第一个不合并单元格的值
            for (let i = 0; i < childFilterArr.length; i++) {
                (maxNum > 9000 || !maxNum) && (maxNum = $(childFilterArr[i]).prev().attr("rowspan") && fieldName != "8" ? $(childFilterArr[i]).prev().attr("rowspan") : 9999);
                let key = flag ? childFilterArr[i].innerHTML : childFilterArr[i].textContent;//获取下一个单元格的值
                let nextIndex = i + 1;
                let tdNum = childFilterTextObj[key];
                let curNum = maxNum < tdNum ? maxNum : tdNum;
                if (canRowspan) {
                    for (let j = 1; j <= curNum && (i + j < childFilterArr.length);) {//循环获取最终合并数及finalNext的index和key
                        finalNextKey = flag ? childFilterArr[i + j].innerHTML : childFilterArr[i + j].textContent;
                        finalNextIndex = i + j;
                        if ((key != finalNextKey && curNum > 1) || maxNum == j) {
                            canRowspan = true;
                            curNum = j;
                            break;
                        }
                        j++;
                        if ((i + j) == childFilterArr.length) {
                            finalNextKey = undefined;
                            finalNextIndex = i + j;
                            break;
                        }
                    }
                    childFilterArr[i].setAttribute("rowspan", curNum);
                    if ($(childFilterArr[i]).find("div.rowspan").length > 0) {//设置td内的div.rowspan高度适应合并后的高度
                        $(childFilterArr[i]).find("div.rowspan").parent("div.layui-table-cell").addClass("rowspanParent");
                        $(childFilterArr[i]).find("div.layui-table-cell")[0].style.height = curNum * 38 - 10 + "px";
                    }
                    canRowspan = false;
                } else {
                    childFilterArr[i].style.display = "none";
                }
                if (--childFilterTextObj[key] == 0 | --maxNum == 0 | --curNum == 0 | (finalNextKey != undefined && nextIndex == finalNextIndex)) {//||(finalNextKey!=undefined&&key!=finalNextKey)
                    canRowspan = true;
                }
            }
        }
        //合并数据表格行
        var layuiRowspan = function (fieldNameTmp, index, flag) {
            let fieldName = [];
            if (typeof fieldNameTmp == "string") {
                fieldName.push(fieldNameTmp);
            } else {
                fieldName = fieldName.concat(fieldNameTmp);
            }
            for (let i = 0; i < fieldName.length; i++) {
                execRowspan(fieldName[i], index, flag);
            }
        }

        //下拉框初始化
        function renderSelect(){
             //获取字典下拉框数据
             getDicListByCodes({'diccode': ['DYMK','gwjpsy']}, function (res){
                if(res.code === 1) {  
                    let data = res.data;
                    if(scale_type != 1){                    
                        delete data.gwjpsy;
                    }
                    for(var k in data) {
                        $('[data-role='+k+'List]').empty().append('<option value="">请选择</option>');
                        let d = data[k];
                        for (var i in d) {
                            $('[data-role='+k+'List]').append('<option value="' + d[i].itemcode + '">' + d[i].itemname + '</option>');
                        }
                    }
                    xmDemo = xmSelect.render({
                        el: '#xm-demo',                            
                        autoRow: true,
                        theme: {
                            color: '#2d8cf0',
                        },
                        prop: {
                            name: 'itemname',
                            value: 'itemcode',
                        },
                        name:'check_module',
                        layVerify: 'required',
                        layVerType: 'msg',
                        layReqText:'对应模块不能为空',
                        data: res.data.dymk
                    })
                    xmDemo2 = xmSelect.render({
                        el: '#xm-demo2',                            
                        autoRow: true,
                        theme: {
                            color: '#2d8cf0',
                        },
                        prop: {
                            name: 'itemname',
                            value: 'itemcode',
                        },
                        name:'check_module',
                        layVerify: 'required',
                        layVerType: 'msg',
                        layReqText:'对应模块不能为空',
                        data: res.data.dymk
                    })
                    xmDemo3 = xmSelect.render({
                        el: '#xm-demo3',                            
                        autoRow: true,
                        theme: {
                            color: '#2d8cf0',
                        },
                        prop: {
                            name: 'itemname',
                            value: 'itemcode',
                        },
                        name:'check_module',
                        layVerify: 'required',
                        layVerType: 'msg',
                        layReqText:'对应模块不能为空',
                        data: res.data.dymk
                    })
                }
            });
            
        }
    });
</script>

<style>
    #detail-form{padding: 10px;}
    .layuik-form{padding: 20px}
    .layuik-font-btn{margin: 0 5px;cursor: pointer;}
    td .layui-form-select {margin-top: -3px;margin-left: -15px;margin-right: -15px;}
    .layui-form-label{width:100px !important;}
    .layui-input-block {margin-left: 130px !important;}
    .layui-table{border: 1px #eee solid !important;}
</style>

<script type="text/html" id="detailToolbarHead">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-normal" type="button" lay-event="add"> 新增 </button>
    </div>
</script>

<script type="text/html" id="switchTpl">
    <input type="checkbox" name="self_rate" value="@{{ d.id }}" lay-skin="switch" lay-text="是|否" lay-filter="selfRate" @{{ d.self_rate === 1 ? 'checked' : '' }}>
</script>


<script type="text/html" id="opDemo">
    <a class="layui-font-orange layuik-font-btn"  lay-event="add">新增</a>
    <a class="layui-font-blue layuik-font-btn" lay-event="edit">编辑</a>
    <a class="layuik-font-btn" lay-event="del">删除</a>
</script>

<!-- 量表维护信息 -->
<div class="layui-row">
    <div class="layui-panel">
        <form class="layui-form" action="" id="detail-form" lay-filter="detailForm">
            <div class="layui-row">
                <table id="scale-detail-table" class="layui-table" lay-filter="scaleDetailTable" ></table>
            </div>
            <div class="layui-row">
            <a href="javascript:history.go(-1);" ><button class="layui-btn layui-btn-primary" style="float: right;" type="button">返回</button></a>
            </div>
        </form>
    </div> 
</div> 

<!-- 量表新增弹窗 -->
<div id="add-detail" style="display:none;" >
    <form class="layui-form layuik-form" id="add-detail-form" lay-filter="addDetailForm">  
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>层级指标：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="title[]" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="single_score" value="0"  lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>默认单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="default_score" value="0" required lay-verify="required|number" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>对应模块：</label>
            <div class="layui-input-block layuik-input-block">    
                <!-- <select name="module" class="layui-select" data-role="dymkList"  lay-filter="" data-role="">
                
                </select> -->
                <div type="text" id="xm-demo"  class="xm-select-demo"></div>
            </div>
        </div>
        
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">模块索引：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="scale_index" class="layui-select" data-role="gwjpsyList"  lay-filter="" data-role="">
                
                </select>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>教师自评：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="self_rate" class="layui-select" lay-verify="required" lay-reqText="不能为空" lay-filter="" data-role="">
                    <option value="">请选择</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>评审人：</label>
            <div class="layui-input-block layuik-input-block">   
                <select name="reviewer" class="layui-select" lay-filter="reviewerList" data-role="reviewerList" required lay-verify="required" lay-reqText="不能为空"></select> 
                <input type="text" name="reviewer" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>   -->
        <div class="layui-form-item opt-area">
            <div class="layui-input-block">    
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="subDetail">提交</button>
                <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                <button class="layui-btn layui-btn-primary cancel-btn" type="reset" type="button">取消</button>
                <input name="tier" type="hidden" value="0">
                <input name="scale_id" type="hidden" value="0">
            </div>
        </div>
    </form>
</div>
<!-- 量表行新增弹窗 -->
<div id="add-row-detail" style="display:none;" >
    <form class="layui-form layuik-form" id="add-row-detail-form" lay-filter="addRowDetailForm">  
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>层级指标：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="title[]" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>满分：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="score" required lay-verify="required|number" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">说明：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="desc" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>教师自评：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="self_rate" class="layui-select" lay-verify="required" lay-reqText="不能为空" lay-filter="" data-role="">
                    <option value="">请选择</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>评审人：</label>
            <div class="layui-input-block layuik-input-block">  
                <select name="reviewer" class="layui-select" lay-filter="reviewerList" data-role="reviewerList" required lay-verify="required" lay-reqText="不能为空"></select>  
                 <input type="text" name="reviewer" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>   -->
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="single_score" value="0"  lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>默认单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="default_score" value="0" required lay-verify="required|number" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>对应模块：</label>
            <div class="layui-input-block layuik-input-block">    
                <!-- <select name="module" class="layui-select" data-role="dymkList" lay-verify="required" lay-reqText="对应模块不能为空" lay-filter="" data-role="">
                
                </select> -->
                <div type="text" id="xm-demo2"  class="xm-select-demo"></div>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">模块索引：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="scale_index" class="layui-select" data-role="gwjpsyList"  lay-filter="" data-role="">
                
                </select>
            </div>
        </div> -->

        <div class="layui-form-item opt-area">
            <div class="layui-input-block">    
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="subRowDetail">提交</button>
                <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                <button class="layui-btn layui-btn-primary cancel-btn" type="reset" type="button">取消</button>
                <input name="top_id" type="hidden" value="0">
                <input name="tier" type="hidden" value="0">
                <input name="scale_id" type="hidden" value="0">
            </div>
        </div>
    </form>
</div>
<!-- 量表编辑弹窗 -->
<div id="edit-detail" style="display:none;" >
    <form class="layui-form layuik-form" id="edit-detail-form" lay-filter="editDetailForm">  
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>层级指标：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="title[]" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>满分：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="score" required lay-verify="required|number" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">说明：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="desc" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>教师自评：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="self_rate" class="layui-select" lay-verify="required" lay-reqText="不能为空" lay-filter="" data-role="">
                    <option value="">请选择</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>评审人：</label>
            <div class="layui-input-block layuik-input-block">  
                <select name="reviewer" class="layui-select" lay-filter="reviewerList" data-role="reviewerList" required lay-verify="required" lay-reqText="不能为空"></select>   
                <input type="text" name="reviewer" required lay-verify="required" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>   -->
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="single_score" value="0"  lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>默认单项分数：</label>
            <div class="layui-input-block layuik-input-block">    
                <input type="text" name="default_score" value="0" required lay-verify="required|number" placeholder="请输入" lay-reqText="不能为空" autocomplete="off" class="layui-input"> 
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label"><i class="redstar">*</i>对应模块：</label>
            <div class="layui-input-block layuik-input-block">    
                <!-- <select name="module" class="layui-select" data-role="dymkList" lay-verify="required" lay-reqText="对应模块不能为空" lay-filter="" data-role="">
                
                </select> -->
                <div type="text" id="xm-demo3"  class="xm-select-demo"></div>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label layuik-form-label">模块索引：</label>
            <div class="layui-input-block layuik-input-block">    
                <select name="scale_index" class="layui-select" data-role="gwjpsyList"  lay-filter="" data-role="">
                
                </select>
            </div>
        </div> -->
        <div class="layui-form-item opt-area">
            <div class="layui-input-block">    
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="editDetail">提交</button>
                <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                <button class="layui-btn layui-btn-primary cancel-btn" type="reset" type="button">取消</button>
                <input name="id" type="hidden" value="0">
            </div>
        </div>
    </form>
</div>
